Module-level declarations
Properties
When an account
entity has this as its type
field, it is a lock account
A lock account is like a safe where tokens are put when the users should not be able to access them. This is useful, for example, when the users have staked those tokens or they are participating in an auction where they have put a bid for a certain amount of tokens.
In both cases, the users are still the owners of the assets, but they're not allowed to use them.
An account_link
entity is created that holds the relevant information:
account: the account that owns the asset
secondary: the lock account
type: the purpose of the locking (e.g. "staking", or "auction")
Functions
Retrieves the lock account given an account and the lock type. Creates the account if it does not exist.
Can only be called from an operation.
Computes the id that the lock account will have given the account and the type.
Gets all existing lock accounts for the provided account
Gets existing lock accounts for the provided account where some assets have been locked
Retrieves the total locked sum of the specified asset over various lock types, given the account that locked them. The returned value adds up the values that were locked, regardless of the lock type, for a single asset.
Similar to get_locked_asset_aggregated_balance
, except that it allows retrieving the info for all locked assets.
Retrieves all balances of a certain asset that were locked from a certain account. Paginated, the returned data is a list of tuples containing the amount and a lock type label: list<(lock type, amount)>
Similar to get_locked_asset_balance
, except that it allows retrieving the info for all locked assets.
Transfers an asset to the lock account, rendering it inaccessible to the user.
Can only be called from an operation.
Throws if the required assets cannot be moved. Common cases include:
the amount to transfer is not in the accepted range (0, 2^256) (exclusive)
some conditions added in development through transfer extensions (
before_transfer
orafter_transfer
) aren't metthe account's balance is lower than
amount
Retrieves an asset from the lock account back to the specified account. Note that this function does not perform any authorization before moving the assets; users should thus not be given direct access to this function.
Can only be called from an operation.
Throws if the required assets cannot be moved. Common cases include:
the amount to transfer is not in the accepted range (0, 2^256) (exclusive)
some conditions added in development through transfer extensions (
before_transfer
orafter_transfer
) aren't metthe lock account's balance is lower than
amount
, which means there's less locked tokens than what is being unlocked